#    Rubatom
#    Copyright (c) 2014 Sebastian Dufner
#
#    This file is part of Rubatom.
#
#    Rubatom is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Rubatom is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

require 'rubatom/version'

##
#

module Rubatom
  class UnknownFormatError < IOError
    def initialize(version)
      super(version)
    end
  end

  def self.fail_on_unknown_format(version)
    fail UnknownFormatError, version if HighestFileFormatSupported < version
  end

  class VersionError < StandardError
    def initialize(version)
      super(version)
    end
  end

  def self.fail_on_unsupported_version(version)
    fail VersionError, version if HighestFileFormatSupported < version
  end
end
